<template>
    <div>
        <div>用户名：<input type="text" v-model="username"></div>
        <div>密码：<input type="text" v-model="password"></div>
        <button @click="login">登陆</button>
    </div>
</template>

<script>
import {
    getUserInfo,
    setUserInfo,
    logout
} from '@/utils/auth'
export default {
    data() {
        return {
            username: 'mxdeal',
            password: '123456'
        }
    },
    methods: {
        login() {
            this.$api.manage.login({
                username: this.username,
                password: this.password
            }).then(res => {
                if (res.success) {
                    setUserInfo({
                        username: res.data.username,
                        personId: res.data.personId,
                        tokenApp: res.data.tokenApp
                    })
                    this.$router.push({ path: '/home',query: { token: res.data.tokenApp} })

                }
            });
        }
    }
}
</script>

<style>
</style>
